import {
	userInfo
} from '@/api/auth.js'

const userModules = {
	state: {
		userInfo: {}
	},
	getters: {
		userInfo: state => state.userInfo
	},
	mutations: {
		setUserInfo(state, userInfo) {
			state.userInfo = userInfo;
		}
	},
	actions: {
		async getUserInfo(context, callback) {
			const {
				data
			} = await userInfo();
			context.commit('setUserInfo', data)
			callback && callback(data)
		}
	}
}

export default userModules
